#include <stdio.h>

/*
 * 关于空结构体的大小问题
 * 在c++中，是一个字体，因为它使用一个char来作点位符
 * 而在c中，有具体的编译器的实现有关
 *
 */
struct {} a;
struct {char c} b;

int main(void)
{
	printf("一个空结构体的大小: ");
	printf("sizeof(struct {}) = %d\n", sizeof(a));
	printf("只有一个char类型的结构体的大小:");
	printf("sizeof(struct {char c}) = %d\n", sizeof(b));
	int *p = 10;
	printf("*p = 10:\n");
	printf("\tsizeof(p) = %d\n", sizeof(p));
	printf("\tsizeof(*p) = %d\n", sizeof(*p));

	int a[] = {1, 2, 3, 4};
	printf("a[] = {1, 2, 3, 4}:\n");
	printf("\tsizeof(a) = %d\n", sizeof(a));
	printf("\tsizeof(a[0]) = %d\n", sizeof(a[0]));

	int* p1 = a;
	printf("*p1 = a:\n");
	printf("\tsizeof(p1) = %d\n", sizeof(p1));
	printf("\tsizeof(*p1) = %d\n", sizeof(*p1));

	int* p2 = &a;
	printf("*p2 = &a:\n");
	printf("\tsizeof(p2) = %d\n", sizeof(p2));
	printf("\tsizeof(*p2) = %d\n", sizeof(*p2));
	return 0;
}
